package com.hit.aircraftwar.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.hit.aircraftwar.R;
import com.hit.aircraftwar.setter.ParameterSet;

import java.util.Objects;

public class StartActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        Objects.requireNonNull(getSupportActionBar()).hide();

        Button startReturnButton;
        Button heroAircraft1Button;
        Button heroAircraft2Button;
        //Button定义
        startReturnButton = findViewById(R.id.startReturnButton);
        heroAircraft1Button = findViewById(R.id.heroAircraft1Button);
        heroAircraft2Button = findViewById(R.id.heroAircraft2Button);

        startReturnButton.setOnClickListener(view -> {
            Intent intent = new Intent(StartActivity.this, MainActivity.class);
            startActivity(intent);
        });
        heroAircraft1Button.setOnClickListener(view -> {
            Intent intent = new Intent(StartActivity.this, GameActivity.class);
            //设置英雄机型号
            ParameterSet.INSTANCE.setHeroType(1);
            startActivity(intent);
        });
        heroAircraft2Button.setOnClickListener(view -> {
            Intent intent = new Intent(StartActivity.this, GameActivity.class);
            //设置英雄机型号
            ParameterSet.INSTANCE.setHeroType(2);
            startActivity(intent);
        });

    }
}
